const { getAboutDao, setAboutDao } = require("../dao/aboutDao");
const { formatResponseBody } = require("../utils/tools");

// 获取
exports.getAboutService = async () => {
    const result = await getAboutDao();
    if (result.length) {
        return formatResponseBody({ data: result[0].dataValues.url });
    }
    return formatResponseBody({ data: null });
}

// 设置
exports.setAboutService = async (newAbout) => {
    const { dataValues } = await setAboutDao(newAbout);

    return formatResponseBody({ data: dataValues });
}